/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myftp.core.view.listener;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.table.JTableHeader;
import myftp.app.model.ExplorerTableModel;

/**
 *
 * @author CAVARLE Glenn, LUCAS Stéphane
 */
public class HeaderListener extends MouseAdapter {

    JTableHeader header;

    public HeaderListener(JTableHeader header) {
        this.header = header;
    }

    public void mouseClicked(MouseEvent e) {
	/* Récupération de la colonne à trier */
        int col = header.columnAtPoint(e.getPoint());
	/* Récupération du contenu du tableau */
        ExplorerTableModel model = (ExplorerTableModel) header.getTable().getModel();
	/* Tri du contenu du tableau */
        model.sort(col);
    }
}


